home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13899 < prev    next >
Encoding:
Text File  |  1996-08-05  |  983 b   |  43 lines

  1. Path: uu4news.netcom.com!dodge!news
  2. From: shyam@clipper.robadome.com (Shyam Davuburu)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Reverting of big array ?
  5. Date: 27 Mar 1996 20:49:15 GMT
  6. Organization: Siemens Rolm Communications, Inc.
  7. Message-ID: <4jc9kb$1bs@dodge.eng.sc.rolm.com>
  8. References: <4jbock$s7j@erinews.ericsson.se>
  9. Reply-To: shyam@clipper.robadome.com
  10. NNTP-Posting-Host: atlantis.eng.sc.rolm.com
  11.  
  12. Try this function: 
  13.  
  14. swap(buff,st,end) 
  15. char *buff;
  16. int st; 
  17. int end; 
  18. {
  19.     if(st != end && st < end) { 
  20.         buff[st] = buff[st]+buff[end]; 
  21.         buff[end] = buff[st]-buff[end]; 
  22.         buff[st] = buff[st]-buff[end]; 
  23.         swap(buff,st, end); 
  24.     }
  25. }
  26. main () { 
  27. char *buff = "ABCDEFGHIJKLMN...."; 
  28. swap(buff,0,strlen(buff)-1); 
  29. }
  30.  
  31.  
  32.  
  33.  
  34.  
  35. -- 
  36. -- 
  37. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  38. Shyam Davuluru Siemens Rolm Communications   Phone #'s:   (408)249 3062 (R)
  39. Email - shyam@siemensrolm.com                             (408)492 7328 (W)
  40.       - shind@inow.com
  41.  
  42.  
  43.